print(bool(0))   #false
print(bool(1))   #true
print(bool(-5))   #true
print(bool(0.0))   #false
print(bool(""))   #false
print(bool(" "))   #true
print(bool("abc"))   #true
print(bool([]))   #false
print(bool([1,2]))   #true
print(bool(None))   #false



#进制转换
#int(x,base)指定进制的字符串转换为十进制的整数
#base表示原字符串是几进制的

#将1a2c从十六进制转换为十进制
hex_str='1a2c'
dec=int(hex_str,16)
print(dec)

#将1101从2进制转换为十进制
hex_str1='1101'
dec1=int(hex_str1,2)
print(dec1)

#将17从8进制转换为十进制
hex_str2='17'
dec2=int(hex_str2,8)
print(dec2)


input_str=input('请输入一个数字：')
float_str=float(input_str)+1
print("结果为：",float_str)

print(bool(""))    #False
print(bool(0))    #False
print(bool([]))    #False
print(bool(None))    #False
print(bool(1))    #True

#赋值
a=10
name="qq"
#连续赋值
b=c=d=e=1
#拆包
m,n=3,5
x=("q","w","e")
print(x)

#运算符 幂＞乘除整除取余＞加减 括号内优先
# 幂：** 乘：* 除：/ 整除：// 取余：%
#除法结果总是浮点数
str1="hi"
str2="hi"
result=str1+str2
print(result)

str3="ovo"
str4=str3*3
print(str4)



score = int(input("请输入分数："))

if (0 <= score < 60):
    grade = "不及格"
elif (60 <= score < 80):
    grade = "及格"
elif (80 <= score < 90):
    grade = "良好"
elif (90 <= score < 100):
    grade = "优秀"
else:
    print("分数错误，请输入0-100之间的数字！")
    exit()

print(f"分数是{score}，等级是{grade}")

# 根据年龄进行判断：
# 1.小于0的话：输入错误
# 2.0-5岁：婴幼儿
# 3.6-11：儿童
# 4.12-17显示青少年
# 5.18-59：成年人
# 60及以上：老年人

age=int(input("请输入年龄："))
if age < 0:
    print("输入错误")
elif (0<=age<=5):
    print("婴幼儿")
elif (5 < age <= 11):
    print("儿童")
elif (11 < age <= 17):
    print("青少年")
elif (17 < age <= 59):
    print("成年人")
elif 60 < age :
    print("老年人")

num=1
num_all=0
while num<=100:
    num_all += num
    num+=1
print(num_all)

for i in range(1,11,2):
    print(i)


sum_lx=0
num_lx=1
sum_ji=0
sum_ou=0
for num_lx in range(1,101):
    sum_lx+=num_lx
    if num_lx%2==0:
        sum_ou+=num_lx
    elif num_lx%2==1:
        sum_ji+=num_lx
print("0-100的总和为",sum_lx,"奇数和为",sum_ji,"偶数和为",sum_ou)

